<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<fmt:bundle basename="res">
<head>
    <meta charset="utf-8">
    <title><fmt:message key='ttbl' /></title>
    <jsp:include page="/WEB-INF/commons/commons-header.jsp" flush="true"/>
    <style>
        html {
            background: #fff;
        }
    </style>
</head>

<body>
<div class="layui-container">
    <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">

        <form:form commandName="order" class="layui-form" id="form">

            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend>订单信息</legend>
            </fieldset>

            <table class="layui-table">
                <tbody>
                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='ddbh' /></td>
                    <td width="70%" style="border-color: black;">${order.orderNo}</td>
                </tr>
                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;">订单类型</td>
                    <td width="70%" style="border-color: black;">
                        <c:choose>
                            <c:when test="${item.marketingType eq 0}"><fmt:message key='ptdd' /></c:when>
                            <c:when test="${item.marketingType eq 1}"><fmt:message key='zphddd' /></c:when>
                            <c:when test="${item.marketingType eq 2}"><fmt:message key='pthddd' /></c:when>
                            <c:when test="${item.marketingType eq 3}"><fmt:message key='tjhddd' /></c:when>
                            <c:when test="${item.marketingType eq 4}"><fmt:message key='mshddd' /></c:when>
                            <c:when test="${item.marketingType eq 5}"><fmt:message key='yshddd' /></c:when>
                        </c:choose>
                    </td>
                </tr>
                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='ddzt' /></td>
                    <td width="70%" style="border-color: black;">
                        <c:choose>
                            <c:when test="${order.status eq 1}"><fmt:message key='tjdddfk' /></c:when>
                            <c:when test="${order.status eq 2}"><fmt:message key='fkcgdfh' /></c:when>
                            <c:when test="${order.status eq 3}"><fmt:message key='spckdsh' /></c:when>
                            <c:when test="${order.status eq 4}"><fmt:message key='ddqsdpj' /></c:when>
                            <c:when test="${order.status eq 5}"><fmt:message key='jywc' /></c:when>
                            <c:when test="${order.status eq 6}"><fmt:message key='ddqx' /></c:when>
                            <c:when test="${order.status eq 7}"><fmt:message key='yzfysdj' /></c:when>
                            <c:when test="${order.status eq 8}"><fmt:message key='dzfyswk' /></c:when>
                            <c:when test="${order.status eq 9}"><fmt:message key='xxzzdsh' /></c:when>
                            <c:when test="${order.status eq 10}"><fmt:message key='dbfsh' /></c:when>
                        </c:choose>
                    </td>
                </tr>

                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='xdsj' /></td>
                    <td width="70%" style="border-color: black;"><fmt:formatDate value="${order.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                </tr>
                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='spjgxj' /></td>
                    <td width="70%" style="border-color: black;"><fmt:formatNumber value="${order.goodsSubtotalPrice}" type="CURRENCY"/></td>
                </tr>
                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='yf' /></td>
                    <td width="70%" style="border-color: black;"><fmt:formatNumber value="${order.freightPrice}" type="CURRENCY"/></td>
                </tr>
                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='ddzj' /></td>
                    <td width="70%" style="border-color: black;"><fmt:formatNumber value="${order.price}" type="CURRENCY"/></td>
                </tr>

                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='spsl' /></td>
                    <td width="70%" style="border-color: black;">${order.goodsQuantity}</td>
                </tr>

                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='shsj' /></td>
                    <td width="70%" style="border-color: black;">
                        <fmt:formatDate value="${order.receiptTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                    </td>
                </tr>


                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='shr' /></td>
                    <td width="70%" style="border-color: black;">
                            ${order.deliveryName}
                    </td>
                </tr>
                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='shdz' /></td>
                    <td width="70%" style="border-color: black;">
                            ${order.deliveryProvince}${order.deliveryCity}${order.deliveryArea}${order.deliveryAddress}
                    </td>
                </tr>
                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='shrdh' /></td>
                    <td width="70%" style="border-color: black;">
                            ${order.deliveryMobile}
                    </td>
                </tr>
                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='fhwlgs' /></td>
                    <td width="70%" style="border-color: black;">
                            ${order.expressCompany}
                    </td>
                </tr>
                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='fhwldh' /></td>
                    <td width="70%" style="border-color: black;">
                            ${order.expressesNo}
                    </td>
                </tr>

                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='ddbz' /></td>
                    <td width="70%" style="border-color: black;">
                            ${order.note}
                    </td>
                </tr>

                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='zffs' /></td>
                    <td width="70%" style="border-color: black;">
                        <c:choose>
                            <c:when test="${order.payMethod eq 1}"><fmt:message key='wx' /></c:when>
                            <c:when test="${order.payMethod eq 2}"><fmt:message key='zfbzf' /></c:when>
                            <c:when test="${order.payMethod eq 3}"><fmt:message key='qbye' /></c:when>
                            <c:when test="${order.payMethod eq 4}"><fmt:message key='gwkzf' /></c:when>
                            <c:when test="${order.payMethod eq 5}"><fmt:message key='xxzz' /></c:when>
                            <c:when test="${order.payMethod eq 6}"><fmt:message key='qbye' /></c:when>
                        </c:choose>
                    </td>
                </tr>

                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='sfkjfp' /></td>
                    <td width="70%" style="border-color: black;">
                        <c:choose>
                            <c:when test="${order.haveInvoice eq 1}"><fmt:message key='bkfp' /></c:when>
                            <c:when test="${order.haveInvoice eq 2}"><fmt:message key='kjfp' /></c:when>
                        </c:choose>
                    </td>
                </tr>

                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='fptklx' /></td>
                    <td width="70%" style="border-color: black;">
                        <c:choose>
                            <c:when test="${order.invoiceTitleType eq 1}"><fmt:message key='qiye' /></c:when>
                            <c:when test="${order.invoiceTitleType eq 2}">个人</c:when>
                        </c:choose>
                    </td>
                </tr>

                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='fplx' /></td>
                    <td width="70%" style="border-color: black;">
                        <c:choose>
                            <c:when test="${order.invoiceType eq 1}"><fmt:message key='pp' /></c:when>
                            <c:when test="${order.invoiceType eq 2}"><fmt:message key='zuanp' /></c:when>
                        </c:choose>
                    </td>
                </tr>

                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='fptt' /></td>
                    <td width="70%" style="border-color: black;">
                        ${order.invoiceTitle}
                    </td>
                </tr>

                <tr>
                    <td width="20%" style="background-color:#eaeaea;border-color: black;"><fmt:message key='spsh' /></td>
                    <td width="70%" style="border-color: black;">
                            ${order.invoiceTFN}
                    </td>
                </tr>


                </tbody>
            </table>

            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend><fmt:message key='gwqd' /></legend>
            </fieldset>

            <table class="layui-table">
                <thead>
                <th style="border-color: black;"><fmt:message key='sptp' /></th>
                <th style="border-color: black;"><fmt:message key='spmc' /></th>
                <th style="border-color: black;"><fmt:message key='dj' /></th>
                <th style="border-color: black;"><fmt:message key='hh' /></th>
                <th style="border-color: black;">SKU</th>
                <th style="border-color: black;"><fmt:message key='sl' /></th>
                <th style="border-color: black;"><fmt:message key='kc' /></th>
                <th style="border-color: black;"><fmt:message key='xiaoj' /></th>
                </thead>
                <tbody>
                <c:forEach items="${order.details}" var="detail">

                    <tr>
                        <td style="border-color: black;"><img class="preview" style="width:40px;" src="${store_domain}/uploads/${detail.defaultImage}"/></td>
                        <td style="border-color: black;">${detail.goodsName}</td>
                        <td style="border-color: black;">
                            <fmt:formatNumber value="${detail.unitPrice}" type="CURRENCY"/>
                        </td>
                        <td style="border-color: black;">${detail.productNo}</td>
                        <td style="border-color: black;">${detail.specs}</td>
                        <td style="border-color: black;">${detail.quantity}</td>
                        <td style="border-color: black;">${detail.sku.store}</td>
                        <td style="border-color: black;"><fmt:formatNumber value="${detail.price}" type="CURRENCY"/></td>
                    </tr>
                </c:forEach>
                <tr>
                    <td colspan="8" style="text-align: right;border-color: black;"><b style="color:red;"><fmt:message key='hj' />：<fmt:formatNumber value="${order.price}" type="CURRENCY"/></b>&nbsp;&nbsp;<fmt:message key='hyf' />（<fmt:formatNumber value="${order.freightPrice}" type="CURRENCY"/>）</td>
                </tr>
                </tbody>
            </table>


            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend><fmt:message key='fhjl' /></legend>
            </fieldset>


            <c:forEach items="${deliveries}" var="item" varStatus="index">


                <h3>发货记录${index.index + 1}</h3>
                <div class="layui-form-item">
                    <label class="layui-form-label"><fmt:message key='wlgs' /></label>
                    <div class="layui-form-mid layui-word-aux">
                            ${item.expressCompany}
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><fmt:message key='wldh' /></label>
                    <div class="layui-form-mid layui-word-aux">
                            ${item.expressNo}
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><fmt:message key='fhsj' /></label>
                    <div class="layui-form-mid layui-word-aux">
                        <fmt:formatDate value="${item.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><fmt:message key='fhxq' /></label>
                    <div class="layui-form-mid layui-word-aux">

                        <table class="layui-table">
                            <thead>
                            <th style="border-color: black;"><fmt:message key='sptp' /></th>
                            <th style="border-color: black;"><fmt:message key='sptp' /></th>
                            <th style="border-color: black;">SKU</th>
                            <th style="border-color: black;"><fmt:message key='sl' /></th>
                            </thead>
                            <tbody>
                            <c:forEach items="${item.details}" var="detail">
                                <tr>
                                    <td style="border-color: black;"><img class="preview" style="width:40px;" src="${store_domain}/uploads/${detail.orderDetail.defaultImage}"/></td>
                                    <td style="border-color: black;">${detail.orderDetail.goodsName}</td>
                                    <td style="border-color: black;">${detail.orderDetail.specs}</td>
                                    <td style="border-color: black;">${detail.deliveryQuantity}</td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                    </div>
                </div>

            </c:forEach>


        </form:form>
    </div>
</div>

<script>

    $(function () {

        layui.use(['form', 'laydate'], function () {

            var form = layui.form;
            var laydate = layui.laydate;

        });

    });
</script>
</body>
</fmt:bundle>
</html>